package org.darkforest.model;

import org.darkforest.common.util.Page;

import java.util.List;

public class Spec extends Page<Spec> {
    private Integer spId;

    private Integer spParentId;

    private String spName;

    private Integer spSort;

    private Integer classId;

    private String className;

    private List<Spec> specList;


    public String getChildrenSpecs(){
        if(this.specList==null){
            return null;
        }else{
            String str= "";
            for(Spec spec:specList){
                str+=spec.getSpName()+",";
            }
            if(str.length()>0){
                return str.substring(0,str.length()-1);

            }else{
                return str;
            }
        }
    }


    public Spec(){}


    public Spec(boolean pageSwitch){
        super.setPageSwitch(pageSwitch);
    }

    public Spec(Integer classId){
        this.classId = classId;
    }

    public Spec( Integer spId,String spName) {
        this.spId = spId;
        this.spName = spName;
    }

    private List<SpecValue> specValueList;

    public List<SpecValue> getSpecValueList() {
        return specValueList;
    }

    public void setSpecValueList(List<SpecValue> specValueList) {
        this.specValueList = specValueList;
    }
    public List<Spec> getSpecList() {
        return specList;
    }

    public void setSpecList(List<Spec> specList) {
        this.specList = specList;
    }
    public Integer getSpId() {
        return spId;
    }

    public Integer getSpParentId() {
        return spParentId;
    }

    public void setSpParentId(Integer spParentId) {
        this.spParentId = spParentId;
    }

    public void setSpId(Integer spId) {
        this.spId = spId;
    }

    public String getSpName() {
        return spName;
    }

    public void setSpName(String spName) {
        this.spName = spName == null ? null : spName.trim();
    }

    public Integer getSpSort() {
        return spSort;
    }

    public void setSpSort(Integer spSort) {
        this.spSort = spSort;
    }

    public Integer getClassId() {
        return classId;
    }

    public void setClassId(Integer classId) {
        this.classId = classId;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className == null ? null : className.trim();
    }
}